package com.sykj.springboot.test.designMode.Observer1;

public class main {

    //观察者
    public static void main(String[] args) {
        LiSi liSi = new LiSi();
        HanFeiZi hanFeiZi = new HanFeiZi();

        Watch breakfast = new Watch(hanFeiZi, liSi, "breakfast");
        breakfast.start();


        Watch hanfun = new Watch(hanFeiZi, liSi, "hanfun");
        hanfun.start();
        System.out.println("观察者启动");

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        hanFeiZi.haveBreakFast();
        hanFeiZi.haveFun();

    }
}
